bool isPowerOfTwo(int n) {
    while (n % 2 == 0 && n)
    {
        n /= 2;
    }
    return n == 1;
}



int subtractProductAndSum(int n) {
    int s = 0, m = 1;
    while (n)
    {
        int x = n % 10;
        n /= 10;
        m *= x;
        s += x;
    }
    return m - s;
}


int addDigits(int num) {
    int sum = num;
    int i, j = 0;
    while (sum >= 10)
    {

        i = sum % 10;
        j = sum / 10;
        sum = i + j;
    }
    return sum;
}



char* toLowerCase(char* s) {
    int len = strlen(s);
    for (int i = 0; i < len; i++)
    {
        s[i] = tolower(s[i]);
    }
    return s;
}




